package com.ruoyi.system.controller.appcontroller;

import com.ruoyi.system.domain.Merchant;
import com.ruoyi.system.service.MerchantService;
import com.ruoyi.system.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MerchantController {
    @Autowired
    private MerchantService merchantService;
    @RequestMapping("/api/merchant/add")
    public Result add(@RequestBody Merchant merchant){
        try {
//            System.out.println(merchant);
            return merchantService.add(merchant);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error(400, "提交失败!" + e.getMessage());
        }
    }
}
